import base64 as b64


encoded_str = ''

with open("D:\\Desktop\\r.pdf", 'rb') as file:
    # print(str(file.read·(),'UTF-8'))
    encoded_str = b64.b64encode(file.read()).decode('ASCII')
    print(encoded_str[0:10])
    # print(encoded_file.decode('ASCII'))
    # print(type(encoded_file))
    # print(file.read())

# str1 ='9awIDpTTx3Uv3OSN+dfzey'

with open("D:\\Desktop\\1.txt", 'w',encoding='utf-8') as file:
    file.write(encoded_str)



# print(b64.b64decode(str1.encode('utf-8')).decode('utf-8'))
